name: Tweet nightly

on:
  issues:
    types:
      - labeled
      - closed

jobs:
  tweet-nightly:
    if: (github.event.action == 'labeled' && github.event.label.name == 'release-notes/social' && github.event.issue.state == 'closed') || (github.event.action == 'closed' &&  contains(github.event.issue.labels.*.name, 'release-notes/social'))
    runs-on: ubuntu-latest
    steps:
      - name: Tweet
        uses: snow-actions/tweet@v1.4.0
        env:
          CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
          CONSUMER_API_SECRET_KEY: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
          ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
          ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
        with:
          status: "🎉 Issue resolved: ${{ github.event.issue.title }} by ${{ github.event.issue.user.login }}\n${{ github.event.issue.html_url }}"
